package com.xrc;

public class Account {
    //属性
    private int id;//账户
    private double balance;//余额
    private double annualInterestRate;//年利率
    //方法

    public int getId() {
        return id;
    }

    public void setId(int id) {
        this.id = id;
    }

    public double getBalance() {
        return balance;
    }

    public void setBalance(double balance) {
        this.balance = balance;
    }

    public double getAnnualInterestRate() {
        return annualInterestRate;
    }

    public void setAnnualInterestRate(double annualInterestRate) {
        this.annualInterestRate = annualInterestRate;
    }
    //取款
    public void withdraw (double amount){
        if(balance>amount){
            balance-=amount;
            System.out.println("成功取出"+amount+"元");
            System.out.println(balance);
        }else {
            System.out.println("余额不足，取款失败");
        }
    }
    //存款
    public void deposit (double amount){
        balance+=amount;
        System.out.println("成功存入："+amount+"元");
    }

}
